using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;
using Utility;

public partial class Admin_PhuongThucThanhToanThem : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btn_Add_Click(object sender, EventArgs e)
    {
        try
        {
            tbPhuongThucThanhToan  phuongthucthanhtoan = new tbPhuongThucThanhToan ();
            phuongthucthanhtoan.TenPTTT = txt_tenphuongthucthanhtoan.Text;
            if (fu_hinh.HasFile)
            {
                string filename = DateTime.Now.Ticks.ToString() + "_" + fu_hinh.FileName;
                fu_hinh.SaveAs(Server.MapPath("~/Photos/" + filename));

                System.Drawing.Image img = System.Drawing.Image.FromFile(
                    Server.MapPath("~/Photos/" + filename));
                ImageUtility.MakeThumbnailPhoto(img, 100, 100, Server.MapPath("~/Photos/Thumb/"), filename);
                phuongthucthanhtoan .Hinh  = filename;
            }
            else
            {
                phuongthucthanhtoan .Hinh  = "hinh.jpg";
            }
            tbPhuongThucThanhToanBUS.Insert(phuongthucthanhtoan);
        }
        catch
        {
        }
        Response.Redirect("~/Admin/PhuongThucThanhToanDanhSach.aspx");
    }
}

